/* 群聊功能样式 */

/* Tab导航扩展样式 */
.tab-navigation {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 20px;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.tab-btn.active {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

.tab-btn:hover:not(.active) {
    background: #e3f2fd;
    border-color: #2196F3;
}

.tab-icon {
    font-size: 16px;
    margin-bottom: 4px;
}

/* 创建群聊样式 */
.create-group-form {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.friends-selection-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    background: white;
}

.friends-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

.select-all-friends {
    padding: 4px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
}

.friends-selection-list {
    max-height: 150px;
    overflow-y: auto;
}

.friend-selection-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.friend-selection-item:hover {
    background: #f9f9f9;
}

.friend-checkbox {
    margin-right: 10px;
}

.friend-checkbox-input {
    margin: 0;
    cursor: pointer;
}

.friend-checkbox-label {
    cursor: pointer;
}

.friend-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.friend-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e3f2fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 10px;
}

.friend-details {
    flex: 1;
}

.friend-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.friend-id {
    font-size: 12px;
    color: #666;
}

/* 已选成员样式 */
.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: white;
}

.selected-member {
    display: flex;
    align-items: center;
    background: #e3f2fd;
    border-radius: 15px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #2196F3;
}

.selected-member.default-member {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.member-name {
    margin-right: 4px;
}

.member-type {
    font-size: 10px;
    color: #666;
}

.selected-member.default-member .member-type {
    color: #e8f5e8;
}

.remove-member-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    margin-left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-member-btn:hover {
    background: rgba(0,0,0,0.1);
}

.create-group-submit {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.create-group-submit:hover {
    background: #45a049;
}

/* 删除群聊样式 */
.delete-group-content {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
}

.delete-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.delete-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #f44336;
}

.refresh-group-list {
    padding: 6px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.delete-group-list {
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
    max-height: 300px;
    overflow-y: auto;
}

.delete-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.delete-group-item:last-child {
    border-bottom: none;
}

.group-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.group-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e3f2fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
}

.group-details {
    flex: 1;
}

.group-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.group-id {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.group-members {
    font-size: 12px;
    color: #888;
    margin-bottom: 2px;
}

.group-time {
    font-size: 11px;
    color: #999;
}

.delete-group-btn {
    padding: 6px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.delete-group-btn:hover {
    background: #d32f2f;
}

/* 提示信息样式 */
.create-group-tips,
.delete-group-tips {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #856404;
}

.tip-item:last-child {
    margin-bottom: 0;
}

.tip-icon {
    font-size: 16px;
}

/* 群聊消息样式 */
.group-message-item {
    border-left: 3px solid #4CAF50;
}

.group-message-item .message-avatar {
    background: #e8f5e8;
}

.group-message-item .message-name::after {
    content: " (群聊)";
    font-size: 11px;
    color: #4CAF50;
    font-weight: normal;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .tab-navigation {
        grid-template-columns: repeat(2, 1fr);
        gap: 3px;
    }

    .tab-btn {
        padding: 8px 6px;
        font-size: 11px;
    }

    .tab-icon {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .create-group-form,
    .delete-group-content {
        padding: 15px;
    }

    .friends-selection-container {
        max-height: 150px;
    }

    .delete-group-list {
        max-height: 200px;
    }
}

/* 加载和空状态样式 */
.loading-state,
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.loading-icon,
.empty-icon,
.error-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.loading-text,
.empty-text,
.error-text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.empty-hint,
.error-details {
    font-size: 14px;
    color: #999;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.friend-selection-item,
.delete-group-item {
    animation: fadeIn 0.3s ease-out;
}

/* 滚动条美化 */
.friends-selection-list::-webkit-scrollbar,
.delete-group-list::-webkit-scrollbar {
    width: 6px;
}

.friends-selection-list::-webkit-scrollbar-track,
.delete-group-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.friends-selection-list::-webkit-scrollbar-thumb,
.delete-group-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.friends-selection-list::-webkit-scrollbar-thumb:hover,
.delete-group-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 消息列表中的群聊和好友差异化样式 */

/* 群聊条目样式 */
.message-item.group-item {
    border-left: 4px solid #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
    position: relative;
}

.message-item.group-item:hover {
    border-left-color: #45a049;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15) 0%, rgba(76, 175, 80, 0.08) 100%);
    transform: translateX(3px);
}

.message-avatar.group-avatar {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.group-badge {
    background: #4CAF50;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 8px;
    font-weight: bold;
}

.group-members-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

.member-count {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid #4CAF50;
    color: #4CAF50;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* 个人好友条目样式 */
.message-item.friend-item {
    border-left: 4px solid #2196F3;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.08) 0%, rgba(33, 150, 243, 0.03) 100%);
}

.message-item.friend-item:hover {
    border-left-color: #1976D2;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.12) 0%, rgba(33, 150, 243, 0.05) 100%);
    transform: translateX(3px);
}

.message-item.friend-item .message-avatar {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

/* 消息内容文本差异化 */
.message-item.group-item .message-text {
    color: #2d5016;
    font-style: italic;
}

.message-item.friend-item .message-text {
    color: #1565C0;
}

/* 消息项通用样式增强 */
.message-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
}

.message-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 响应式布局调整 */
@media (max-width: 600px) {
    .group-members-info {
        display: none;
    }

    .message-item.group-item,
    .message-item.friend-item {
        border-left-width: 3px;
    }

    .message-avatar.group-avatar {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .group-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
}

/* 群聊消息框样式区分 */
.message-detail-app.group-chat {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(76, 175, 80, 0.02) 100%);
}

.message-detail-app.group-chat .message-send-area {
    border-top: 2px solid #4CAF50;
}

.message-detail-app.group-chat .send-message-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 1px solid #4CAF50;
}

.message-detail-app.group-chat .send-message-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.message-detail-app.group-chat #message-detail-input {
    border: 2px solid rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.05);
}

.message-detail-app.group-chat #message-detail-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* 群聊指示器 */
.group-chat-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 列表排序：群聊优先显示 */
.message-list {
    display: flex;
    flex-direction: column;
}

.message-item.group-item {
    order: 1;
}

.message-item.friend-item {
    order: 2;
}

/* 群聊和好友之间的分隔线 */
.group-friend-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
    margin: 10px 20px;
    order: 1.5;
}

/* 响应式适配 */
@media (max-width: 480px) {
    .group-members-info {
        padding: 0 5px;
    }

    .member-count {
        font-size: 10px;
        padding: 3px 6px;
    }

    .group-badge {
        font-size: 9px;
        padding: 1px 4px;
        margin-left: 5px;
    }
}

/* 动画效果 */
@keyframes groupPulse {
    0% { box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(76, 175, 80, 0.5); }
    100% { box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3); }
}

.message-item.group-item.has-new-message .message-avatar.group-avatar {
    animation: groupPulse 2s ease-in-out infinite;
}

/* 群聊特有的消息类型样式 */
.group-message-type {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 5px;
}

/* 群聊发送状态提示 */
.send-status-toast.group {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-left: 4px solid #2E7D32;
}

.send-status-toast.group::before {
    content: "👥 ";
    font-weight: bold;
}
